import { request } from '../../../request';

/**
 * 查询所有工序
 *
 * @param params
 * @returns
 */
export function getAllProcesses() {
  return request({
    url: '/inspection/inspectionform/selectProcesses'
  });
}

/** 查询所有表单 */
export function getAllForms() {
  return request({
    url: '/inspection/inspectionform/selectForms',
    params: {
      pageSize: 9999,
      pageNum: 1
    }
  });
}

/**
 * 获取表单的检查项
 *
 * @param params.inspectionFormId 表单Id
 * @param params.delFlag 状态 0 启用 1 停用
 * @returns
 */
export function getFormCheckItems(params: any) {
  return request({
    url: '/inspection/inspectionform/selectItemsByFormId',
    params
  });
}

/**
 * 修改表单
 *
 * @param data
 * @returns
 */
export function updateFormCheckItems(data: any) {
  return request({
    url: '/inspection/inspectionform/updateForm',
    method: 'post',
    data
  });
}

/**
 * 修改检查项
 *
 * @param data
 * @returns
 */
export function updateCheckItem(data: any) {
  return request({
    url: '/inspection/inspectionform/updateItem',
    method: 'post',
    data
  });
}

/**
 * 新增检查项
 *
 * @param data
 * @returns
 */
export function addCheckItem(data: any) {
  return request({
    url: '/inspection/inspectionform/insertItem',
    method: 'post',
    data
  });
}

/** 撤审 */
export function withdrawal(data: any) {
  return request({
    url: '/inspection/inspectionData/rollBack',
    method: 'post',
    data
  });
}
